use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};
use sqlx::FromRow;

#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct Account {
    pub id: String,
    pub platform: String,
    pub username: String,
    pub password: Option<String>,
    pub status: String,
    pub last_active: Option<DateTime<Utc>>,
    pub created_at: DateTime<Utc>,
    pub cookies: Option<String>,
    pub notes: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct Platform {
    pub id: String,
    pub name: String,
    pub logo: Option<String>,
    pub login_url: String,
    pub url_pattern: Option<String>,
    pub dom_selector: Option<String>,
    pub api_endpoint: Option<String>,
    pub is_enabled: bool,
    pub created_at: DateTime<Utc>,
}

#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct Tab {
    pub id: String,
    pub title: String,
    pub url: String,
    pub account_id: Option<String>,
    pub is_active: bool,
    pub favicon: Option<String>,
    pub created_at: DateTime<Utc>,
}

#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct Session {
    pub id: String,
    pub account_id: String,
    pub cookies: String,
    pub user_agent: Option<String>,
    pub created_at: DateTime<Utc>,
    pub expires_at: Option<DateTime<Utc>>,
}